import request from '@/utils/request'

// 部门信息
export function getTree(data) {
  return request({
    url: "/base/org/tree",
    method: "get",
  });
}

// 查询用户列表
export function getList(query) {
  return request({
    url: '/base/auth/user/page',
    method: 'get',
    params: query
  })
}

// delete 用户列表
export function deleteList(query) {
  return request({
    url: '/base/auth/user/del/' + query,
    method: 'get',
  })
}

// 查询部门父列表
export function deptListArr(query) {
  return request({
    url: '/base/org/dept/tree/11',
    method: 'get',
    params: query
  })
}

// 查询部门子列表
export function deptListdept(query) {
  return request({
    url: '/auth/org/team/tree/' + query,
    method: 'get'
  })
}
// 查询部门子列表
export function deptListmajor(query) {
  return request({
    url: '/auth/org/major/tree/' + query,
    method: 'get',
  })
}
// 查询部门子列表
export function deptListteam(query) {
  return request({
    url: '/auth/org/post/tree/' + query,
    method: 'get',
  })
}
// 查询部门子列表
export function deptListpost(query) {
  return request({
    url: '/auth/org/team/tree/',
    method: 'get',
    params: query
  })
}

// 新增角色
export function userAdd(data) {
  return request({
    url: '/base/auth/user/owner/add',
    method: 'post',
    data: data
  })
}

// 修改角色
export function userEdit(data) {
  return request({
    url: '/base/auth/user/update',
    method: 'post',
    data: data
  })
}


// 删除角色
export function treeDel(roleId) {
  return request({
    url: '/base/auth/user/del/' + roleId,
    method: 'delete'
  })
}

// 重置密码
export function editPass(data) {
  return request({
    url: '/base/auth/user/password/byCode',
    method: 'post',
    // data: data
  })
}


// 修改个人信息
export function updateUserProfile(data) {
  return request({
    url: '/base/auth/user/update',
    method: 'post',
    data: data
  })
}
// 修改密码
export function updateUserPwd(data) {
  return request({
    url: '/base/auth/user/password/update',
    method: 'post',
    data: data
  })
}
// 图片查询
export function photoH(data) {
  return request({
    url: '/base/file/previewPath?id=' + data,
    method: 'get',
    // data: data
  })
}
//
// 修改头像
export function uploadAvatar(data) {
  return request({
    url: '/base/auth/user/update',
    method: 'post',
    data: data
  })
}
// 查询安全学习
export function studyList(query) {
  return request({
    url: '/auth/org/team/tree',
    method: 'get',
    params: query
  })
}
// 根据主键id查询
export function getEditData(query) {
  return request({
    url: '/base/auth/user/getUser/' + query,
    method: 'get',
  })
}

// 查询列表
export function getList2(data) {
  return request({
    url: "/business/collect/archives/person/annualOverhaul?state=1&code=" + data,
    method: "get",
  });
}
// 查询列表
export function getList3(data) {
  return request({
    url: "/business/collect/archives/person/studyRecord",
    method: "get",
    params: data
  });
}
// 查询列表
export function getList4(data) {
  return request({
    url: "/business/collect/archives/person/examRecord",
    method: "get",
    params: data
  });
}

// 查看试卷详情
export function getPorData(data) {
  return request({
    url: "/business/training/exam/task/getUserExamResult",
    method: "get",
    params: data,
  });
}

// 根据id更新 用户数据权限（已合并至用户更新）
export function gxUserUpdate(data) {
  return request({
    url: "/base/datascope/update",
    method: "post",
    data: data,
  });
}

// 根据id更新 用户数据权限（已合并至用户更新）
export function getQxList(data) {
  return request({
    url: "/base/datascope/tree/blank",
    method: "get",
  });
}

// 重置密码
export function resetPassword(data) {
  return request({
    url: `/base/auth/user/password/reset/${data}`,
    method: "get"
  });
}

// 公司
export function orgData(data) {
  return request({
    url: "/base/org/list",
    method: "get",
    params: data,
  });
}
